 /* 
  Copyright Software Engineering Research laboratory <serl@cs.wichita.edu>

 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU Library General Public
 License as published by the Free Software Foundation; either
 version 2 of the License, or (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 Library General Public License for more details.

 You should have received a copy of the GNU Library General Public
 License along with this program; if not, write to the Free
 Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
 */

package wichita.edu.xfinder;

import java.io.File;
import java.io.FileInputStream;
import java.util.ArrayList;
import java.util.Scanner;

/*
 @author: Sara Bahrami <mxbahramizanjani@wichita.edu>
 * Purpose: Running XFinder class for list of relevant files for each bugid. 
 * output: calculated xfactor score for each relevant file.
 * 
 */
public class DevRecommender
{
	//CONSTANTS
	//directory of recommended files for each bug id 
	final static private String INDir = "/home/sara/research/codereview/Mylyn/RecommendedFiles/";
	//directory of output
	final static private String OUTDir = "/home/sara/research/codereview/Mylyn/outputallreviews/";
	
	public static void main(String[] args)
	{
		//Walking through input directory and path list of files for each bugid to xfinder
		XFinder xfinder = new XFinder(OUTDir);
			File folder = new File(INDir);
			for (final File fileEntry : folder.listFiles()) {
				ArrayList<String> pathList = new ArrayList<String>(1);
				
			try{	
					Scanner fileReader = new Scanner(new FileInputStream(fileEntry));
					while (fileReader.hasNextLine())
						pathList.add(fileReader.nextLine());
					fileReader.close();	
			
				}
			catch (Exception e)
			{
				System.err.println(e.getMessage());
			}
		
		//run xfinder
		xfinder.run(pathList,fileEntry.getName()); 
		}
	}

}
